import 'package:flutter/material.dart';
import 'package:flutter_getx/res/colors/theme_colors.dart';
import 'package:flutter_getx/res/dimens/dimens.dart';
import 'package:get/get.dart';

class MyCard extends StatelessWidget {
  const MyCard(
      {Key? key,
      required this.child,
      this.color,
      this.shadowColor,
      this.radiusCard})
      : super(key: key);

  final Widget child;
  final Color? color;
  final Color? shadowColor;
  final double? radiusCard;

  @override
  Widget build(BuildContext context) {

    final Color _backgroundColor =
        color ?? backgroundColor;
    final Color _shadowColor =
        Get.isDarkMode ? Colors.transparent : (shadowColor ?? const Color(0x80DCE7FA));

    return DecoratedBox(
      decoration: BoxDecoration(
        color: _backgroundColor,
        borderRadius: BorderRadius.circular(radiusCard ?? radius_card),
        boxShadow: <BoxShadow>[
          BoxShadow(
              color: _shadowColor,
              offset: const Offset(0.0, 2.0),
              blurRadius: radiusCard ?? radius_card,
              spreadRadius: 0.0),
        ],
      ),
      child: child,
    );
  }
}
